#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int n, q, x = 0;
	cin >> n;
	while (n--) {
		cin >> q;
		x += pow(q / 10, q % 10);
	}
	cout << x;
	return 0;
}
